.text-recognition {
  padding: 24px;
  min-height: calc(100vh - 200px);
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);

  .page-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);

    .ant-typography h2 {
      margin-bottom: 8px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
  }

  // 画板卡片
  .canvas-card {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);

    .ant-card-head {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-radius: 16px 16px 0 0;
      
      .ant-card-head-title {
        color: white;
        font-weight: 600;
      }

      .ant-card-extra {
        .ant-btn {
          color: white !important;
          border-color: rgba(255, 255, 255, 0.3) !important;
          background: transparent !important;
          
          &:hover {
            background: rgba(255, 255, 255, 0.1) !important;
            border-color: rgba(255, 255, 255, 0.5) !important;
            color: white !important;
          }
          
          &:focus {
            background: rgba(255, 255, 255, 0.1) !important;
            border-color: rgba(255, 255, 255, 0.5) !important;
            color: white !important;
          }
          
          .anticon {
            color: white !important;
          }
        }
      }
    }

    .ant-card-body {
      padding: 24px;
    }
  }

  // 工具栏
  .toolbar {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 16px;

    .tool-group {
      display: flex;
      align-items: center;
      gap: 8px;

      .ant-typography {
        margin-bottom: 0;
        min-width: 80px;
      }

      .ant-space-compact {
        .ant-btn {
          border-radius: 8px;
          
          &:first-child {
            border-radius: 8px 0 0 8px;
          }
          
          &:last-child {
            border-radius: 0 8px 8px 0;
          }
        }
      }

      .ant-slider {
        .ant-slider-rail {
          background: #e1e5e9;
        }

        .ant-slider-track {
          background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }

        .ant-slider-handle {
          border-color: #667eea;
          
          &:hover {
            border-color: #764ba2;
          }
        }
      }
    }
  }

  // Canvas容器
  .canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: auto;

    .canvas-wrapper {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;

      .drawing-canvas {
        border: 2px solid #e1e5e9;
        border-radius: 8px;
        cursor: crosshair;
        background: white;
        transition: all 0.3s ease;
        width: 800px;
        height: 600px;
        max-width: 100%;
        touch-action: none; // 禁用默认触摸行为
        display: block;
        position: relative;
        z-index: 10;
        pointer-events: auto; // 确保可以接收鼠标事件
        user-select: none; // 禁止文本选择

        &:hover {
          border-color: #667eea;
          box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
        }

        &:active {
          border-color: #5a6fd8;
        }
      }

      .canvas-hint {
        text-align: center;
        padding: 8px 16px;
        background: rgba(102, 126, 234, 0.1);
        border-radius: 20px;
        border: 1px solid rgba(102, 126, 234, 0.2);
      }
    }
  }

  // Canvas操作按钮
  .canvas-actions {
    display: flex;
    justify-content: center;
    gap: 12px;

    .ant-btn {
      border-radius: 8px;
      height: 40px;
      padding: 0 20px;
      font-weight: 500;
      transition: all 0.3s ease;

      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      }

      &.ant-btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        font-size: 16px;

        &:hover {
          background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
        }
      }
    }
  }

  // 结果卡片
  .result-card {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    height: fit-content;

    .ant-card-head {
      background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
      border-radius: 16px 16px 0 0;
      
      .ant-card-head-title {
        color: white;
        font-weight: 600;
      }
    }

    .ant-card-body {
      padding: 24px;
    }
  }

  // OCR服务选择器
  .ocr-service-selector {
    margin-bottom: 16px;
    
    .ant-select {
      .ant-select-selector {
        border-radius: 8px;
        border: 2px solid #e1e5e9;
        transition: all 0.3s ease;
        min-height: 40px;

        &:hover {
          border-color: #1890ff;
        }
      }

      &.ant-select-focused {
        .ant-select-selector {
          border-color: #1890ff;
          box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }
      }
    }
    
    .ant-select-dropdown {
      .ant-select-item {
        padding: 12px 16px;
        
        &:hover {
          background: linear-gradient(135deg, rgba(24, 144, 255, 0.1) 0%, rgba(17, 153, 142, 0.1) 100%);
        }
        
        &.ant-select-item-option-selected {
          background: linear-gradient(135deg, rgba(24, 144, 255, 0.2) 0%, rgba(17, 153, 142, 0.2) 100%);
        }
      }
    }
  }

  // 语言选择器
  .language-selector {
    .ant-select {
      .ant-select-selector {
        border-radius: 8px;
        border: 2px solid #e1e5e9;
        transition: all 0.3s ease;

        &:hover {
          border-color: #11998e;
        }
      }

      &.ant-select-focused {
        .ant-select-selector {
          border-color: #11998e;
          box-shadow: 0 0 0 2px rgba(17, 153, 142, 0.2);
        }
      }
    }
  }

  // OCR进度
  .ocr-progress {
    padding: 16px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    text-align: center;

    .ant-progress {
      margin-top: 8px;
      
      .ant-progress-bg {
        background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%);
      }
    }
  }

  // 识别结果
  .recognition-result {
    .result-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;

      .ant-btn-link {
        padding: 0;
        height: auto;
        color: #11998e;

        &:hover {
          color: #0d7377;
        }
      }
    }

    .ant-input {
      border-radius: 8px;
      border: 2px solid #e1e5e9;
      transition: all 0.3s ease;
      font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
      line-height: 1.6;

      &:focus {
        border-color: #11998e;
        box-shadow: 0 0 0 2px rgba(17, 153, 142, 0.2);
      }

      &::placeholder {
        color: #bdc3c7;
        font-style: italic;
      }
    }

    .result-stats {
      margin-top: 12px;
      display: flex;
      gap: 8px;

      .ant-tag {
        border-radius: 6px;
        font-weight: 500;
      }
    }
  }

  // 设置弹窗
  .settings-content {
    .setting-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      border-bottom: 1px solid #f0f0f0;

      &:last-child {
        border-bottom: none;
      }

      .ant-typography {
        margin-bottom: 0;
      }
    }
  }

  // 响应式设计
  @media (max-width: 1200px) {
    .ant-col {
      margin-bottom: 24px;
    }
  }

  @media (max-width: 768px) {
    padding: 16px;

    .page-header {
      padding: 16px;
      margin-bottom: 24px;
    }

    .toolbar {
      .tool-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;

        .ant-typography {
          min-width: auto;
        }
      }
    }

    .canvas-container {
      .drawing-canvas {
        max-width: 100%;
        height: auto;
      }
    }

    .canvas-actions {
      flex-wrap: wrap;
      
      .ant-btn {
        flex: 1;
        min-width: 120px;
      }
    }
  }

  // 暗色主题支持
  [data-theme='dark'] & {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);

    .page-header {
      background: rgba(52, 73, 94, 0.9);
      color: #ecf0f1;
    }

    .canvas-card,
    .result-card {
      background: #34495e;
      border-color: #4a6741;

      .ant-card-body {
        background: #34495e;
        color: #ecf0f1;
      }
    }

    .toolbar {
      background: #2c3e50;
      color: #ecf0f1;
    }

    .canvas-container {
      background: #2c3e50;
    }

    .recognition-result {
      .ant-input {
        background: #2c3e50;
        border-color: #4a6741;
        color: #ecf0f1;

        &:focus {
          border-color: #11998e;
        }
      }
    }
  }

  // 打印样式
  @media print {
    .toolbar,
    .canvas-actions,
    .page-header {
      display: none;
    }

    .canvas-container {
      box-shadow: none;
      background: white;
    }
  }
}
